intervention.lm <- intervention_mobility_case %>%
mutate(EmergDec.duration = cumsum(EmergDec))
lm.fit.no.lag <- lm(full_time_work_prop ~ EmergDec.duration + smoothed_cli+smoothed_adj_cli, data =intervention.lm
)
intervention.lm$predlm <- c(rep(NA, nrow(intervention.lm) - length(predict(lm.fit.no.lag))), predict(lm.fit.no.lag))
intervention.lm%>%
mutate(policy.duration = cumsum(EmergDec), EmergDeclaration = as.factor(EmergDec)) %>%
ggplot(aes(x = time_value, y = full_time_work_prop, color = EmergDeclaration)) +
geom_point() +
geom_line(aes(x = time_value, y = predlm, colour="fitted value"), size = 1)+
labs(title = "Covariates selected WITHOUT most correlated number of shift")
We suspect that the mobility signal is lower than usual during the weekend.
intervention_mobility_case$weekday <- weekdays(as.Date(intervention_mobility_case$time_value))
p <- ggplot(intervention_mobility_case, aes(x=weekday, y=full_time_work_prop)) +
geom_boxplot()
p
##
## Call:
## lm(formula = full_time_work_prop ~ EmergDec.duration + smoothed_cli +
## smoothed_adj_cli)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0202756 -0.0028614 -0.0000421 0.0029460 0.0125748
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.867e-02 1.190e-03 32.491 < 2e-16 ***
## EmergDec.duration 7.145e-05 1.688e-05 4.232 4.24e-05 ***
## smoothed_cli 8.542e-04 7.575e-04 1.128 0.261
## smoothed_adj_cli -8.345e-04 8.877e-04 -0.940 0.349
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0047 on 136 degrees of freedom
## (328 observations deleted due to missingness)
## Multiple R-squared: 0.4607, Adjusted R-squared: 0.4488
## F-statistic: 38.72 on 3 and 136 DF, p-value: < 2.2e-16
##
## Call:
## lm(formula = full_time_work_prop ~ policy.duration + smoothed_cli +
## smoothed_adj_cli)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0307231 -0.0062396 -0.0004375 0.0054900 0.0241455
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.588e-02 1.290e-03 43.338 < 2e-16 ***
## policy.duration 4.248e-05 1.466e-05 2.898 0.004225 **
## smoothed_cli 2.076e-03 1.036e-03 2.003 0.046712 *
## smoothed_adj_cli -5.100e-03 1.324e-03 -3.852 0.000163 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009018 on 180 degrees of freedom
## (284 observations deleted due to missingness)
## Multiple R-squared: 0.1653, Adjusted R-squared: 0.1514
## F-statistic: 11.88 on 3 and 180 DF, p-value: 3.896e-07